package com.fish.anne.model;

import com.fish.anne.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="system_region" )
public class SystemRegion extends BaseObject implements Serializable {
    private Long regionId;
    private String localName;
    private String package_;
    private Long parentId;
    private Long regionGrade;
    private String regionPath;
    private short showOrder;

    @Id   @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getRegionId() {
        return this.regionId;
    }
    
    public void setRegionId(Long regionId) {
        this.regionId = regionId;
    }
    
    @Column(name="local_name", nullable=false, length=50)
    public String getLocalName() {
        return this.localName;
    }
    
    public void setLocalName(String localName) {
        this.localName = localName;
    }
    
    @Column(name="package", nullable=false, length=20)
    public String getPackage_() {
        return this.package_;
    }
    
    public void setPackage_(String package_) {
        this.package_ = package_;
    }
    
    @Column(name="parent_id", nullable=false)
    public Long getParentId() {
        return this.parentId;
    }
    
    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }
    
    @Column(name="region_grade", nullable=false)
    public Long getRegionGrade() {
        return this.regionGrade;
    }
    
    public void setRegionGrade(Long regionGrade) {
        this.regionGrade = regionGrade;
    }
    
    @Column(name="region_path", nullable=false)
    public String getRegionPath() {
        return this.regionPath;
    }
    
    public void setRegionPath(String regionPath) {
        this.regionPath = regionPath;
    }
    
    @Column(name="show_order", nullable=false)
    public short getShowOrder() {
        return this.showOrder;
    }
    
    public void setShowOrder(short showOrder) {
        this.showOrder = showOrder;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SystemRegion pojo = (SystemRegion) o;

        if (localName != null ? !localName.equals(pojo.localName) : pojo.localName != null) return false;
        if (package_ != null ? !package_.equals(pojo.package_) : pojo.package_ != null) return false;
        if (parentId != null ? !parentId.equals(pojo.parentId) : pojo.parentId != null) return false;
        if (regionGrade != null ? !regionGrade.equals(pojo.regionGrade) : pojo.regionGrade != null) return false;
        if (regionPath != null ? !regionPath.equals(pojo.regionPath) : pojo.regionPath != null) return false;
 
        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (localName != null ? localName.hashCode() : 0);
        result = 31 * result + (package_ != null ? package_.hashCode() : 0);
        result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
        result = 31 * result + (regionGrade != null ? regionGrade.hashCode() : 0);
        result = 31 * result + (regionPath != null ? regionPath.hashCode() : 0);
 
        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("regionId").append("='").append(getRegionId()).append("', ");
        sb.append("localName").append("='").append(getLocalName()).append("', ");
        sb.append("package_").append("='").append(getPackage_()).append("', ");
        sb.append("parentId").append("='").append(getParentId()).append("', ");
        sb.append("regionGrade").append("='").append(getRegionGrade()).append("', ");
        sb.append("regionPath").append("='").append(getRegionPath()).append("', ");
        sb.append("showOrder").append("='").append(getShowOrder()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
